@extends('layout')
@section('content')
{{--*/ $por_pre = number_format((($ganado['prenadas'] * 100)/$ganado['total']),'2','.','');
$por_vivos = number_format((($ganado['vivos'] * 100)/$ganado['total']),'2','.','');
$por_muertos = number_format((($ganado['muertos'] * 100)/$ganado['total']),'2','.','');
$por_les = number_format((($ganado['lesionados'] * 100)/$ganado['total']),'2','.','');
$por_ven = number_format((($ganado['vendidos'] * 100)/$ganado['total']),'2','.','');
/*--}}
<div class="bloque row color2">
    <center><h5>REPORTE DE GANADO</h5></center>
</div>
<div class="row">
    <div class="col-md-3">
        <div class="bloque">
            <div class="tile-progress tile-primary">
            	<div class="tile-header">
            		<center><h3>VIVOS</h3></center>
            		<span>{{'Del total de el Ganado Registrado: '.$ganado['total']}}</span>
            	</div>

                <div class="progress">
                  <div class="progress-bar progress-bar-success" style="width:{{$por_vivos}}%">
                    <span class="sr-only">{{$por_vivos}} Preñadas (success)</span>
                  </div>
                </div>
            	<div class="tile-footer">
            		<h4>
            			<span class="pct-counter">{{$por_vivos}}</span>% Vivos
            		</h4>
            		<span></span>
            	</div>
            </div>
        </div>
    </div>
    {{--*/$hay=Ganado::where('id_estado',1)->where('activo',1)->first();/*--}}
    @if(!empty($hay))
        <div class="col-md-9">
            <div class="bloque">
                <div class="table-responsive" style="overflow: auto">
                  <table class="table table-striped">
                    <tr>
                        <th width="50px">Cod-Ganado</th>
                        <th>Sexo</th>
                        <th>Color</th>
                        <th>Raza</th>
                        <th>Tipo</th>
                        <th>Nacimiento</th>
                        <th>Cod-Madre</th>
                        <th>Cod-padre</th>
                        <th>Opciones</th>
                    </tr>
                    @foreach(Ganado::where('id_estado',1)->where('activo',1)->get() as $ganado)
                        <tr>
                            
                            <td>{{$ganado -> cod_ganado}}</td>
                            <td>{{$ganado -> sexo}} 
                            </td>
                            <td>{{$ganado -> color}}</td>
                            <td>{{$ganado->id_raza}}</td>
                            <td>{{$ganado ->id_tipo}}</td>
                            <td>{{$ganado -> fecha_nacimiento}}</td>
                            <td>{{$ganado -> cod_madre}}</td>
                            <td>{{$ganado -> cod_padre}}</td>
                            <td>
                                <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#myModal" href="{{route('ganado.show',$ganado->id)}}">Ver</button>
                            </td>
                        </tr>
                    @endforeach
                </table>
                
              </div>
            </div>
        </div>
    @else
        <div class="col-md-9">
            <div class="bloque color3">
                    {{'No hay Registro de Ganados Vivos'}}
            </div>
        </div>
    @endif
</div>
<div class="row">
    <div class="col-sm-3">
        <div class="bloque">
            <div class="tile-progress tile-primary">
                <div class="tile-header">
                    <h3>PREÑADAS</h3>
                    <span>{{'Del total de el Ganado Registrado: '.$ganado['total']}}</span>
                </div>

                <div class="progress">
                  <div class="progress-bar progress-bar-success" style="width:{{$por_pre}}%">
                    <span class="sr-only">{{$por_pre}} Preñadas (success)</span>
                  </div>
                </div>
                <div class="tile-footer">
                    <h4>
                        <span class="pct-counter">{{$por_pre}}</span>% Preñadas
                    </h4>
                    <span></span>
                </div>
            </div>
        </div>
    </div>
    {{--*/$hay=Ganado::where('id_estado',5)->where('activo',1)->first();/*--}}
    @if(!empty($hay))
        <div class="col-md-9">
            <div class="bloque">
                <div class="table-responsive" style="overflow: auto">
                  <table class="table table-striped">
                    <tr>
                        <th width="50px">Cod-Ganado</th>
                        <th>Sexo</th>
                        <th>Color</th>
                        <th>Raza</th>
                        <th>Tipo</th>
                        <th>Nacimiento</th>
                        <th>Cod-Madre</th>
                        <th>Cod-padre</th>
                        <th>Opciones</th>
                    </tr>
                    @foreach(Ganado::where('id_estado',5)->where('activo',1)->get() as $ganado)
                        <tr>
                    
                            <td>{{$ganado -> cod_ganado}}</td>
                            <td>{{$ganado -> sexo}} 
                            </td>
                            <td>{{$ganado -> color}}</td>
                            <td>{{$ganado->id_raza}}</td>
                            <td>{{$ganado ->id_tipo}}</td>
                            <td>{{$ganado -> fecha_nacimiento}}</td>
                            <td>{{$ganado -> cod_madre}}</td>
                            <td>{{$ganado -> cod_padre}}</td>
                            <td>
                                <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#myModal" href="{{route('ganado.show',$ganado->id)}}">Ver</button>
                            </td>
                        </tr>
                    @endforeach
                </table>
                
              </div>
            </div>
        </div>
        @else
        <div class="col-md-9">
            <div class="bloque color3">
                    {{'No Existen Vacas En Gestación'}}
            </div>
        </div>
    @endif
</div>
<div class="row">
    <div class="col-sm-3">
        <div class="bloque">
            <div class="tile-progress tile-primary">
                <div class="tile-header">
                    <h3>LESIONADOS</h3>
                    <span>{{'Del total de el Ganado Registrado: '.$ganado['total']}}</span>
                </div>

                <div class="progress">
                  <div class="progress-bar progress-bar-success" style="width:{{$por_les}}%">
                    <span class="sr-only">{{$por_les}} Lesionados (success)</span>
                  </div>
                </div>
                <div class="tile-footer">
                    <h4>
                        <span class="pct-counter">{{$por_les}}</span>% Lesionados
                    </h4>
                    <span></span>
                </div>
            </div>
        </div>
    </div>
    {{--*/$hay=Ganado::where('id_estado',3)->where('activo',1)->first();/*--}}
    @if(!empty($hay))
        <div class="col-md-9">
            <div class="bloque">
                <div class="table-responsive" style="overflow: auto">
                  <table class="table table-striped">
                    <tr>
                        <th width="50px">Cod-Ganado</th>
                        <th>Sexo</th>
                        <th>Color</th>
                        <th>Raza</th>
                        <th>Tipo</th>
                        <th>Nacimiento</th>
                        <th>Cod-Madre</th>
                        <th>Cod-padre</th>
                        <th>Opciones</th>
                    </tr>
                    @foreach(Ganado::where('id_estado',3)->where('activo',1)->get() as $ganado)
                        <tr>
                    
                            <td>{{$ganado -> cod_ganado}}</td>
                            <td>{{$ganado -> sexo}} 
                            </td>
                            <td>{{$ganado -> color}}</td>
                            <td>{{$ganado->id_raza}}</td>
                            <td>{{$ganado ->id_tipo}}</td>
                            <td>{{$ganado -> fecha_nacimiento}}</td>
                            <td>{{$ganado -> cod_madre}}</td>
                            <td>{{$ganado -> cod_padre}}</td>
                            <td>
                                <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#myModal" href="{{route('ganado.show',$ganado->id)}}">Ver</button>
                            </td>
                        </tr>
                    @endforeach
                </table>
                
              </div>
            </div>
        </div>
        @else
        <div class="col-md-9">
            <div class="bloque color3">
                    {{'No Existen Vacas Lesionadas'}}
            </div>
        </div>
    @endif
</div>
<div class="row">
    <div class="col-sm-3">
        <div class="bloque">
            <div class="tile-progress tile-primary">
                <div class="tile-header">
                    <h3>VENDIDOS</h3>
                    <span>{{'Del total de el Ganado Registrado: '.$ganado['total']}}</span>
                </div>

                <div class="progress">
                  <div class="progress-bar progress-bar-success" style="width:{{$por_ven}}%">
                    <span class="sr-only">{{$por_ven}} Vendidos (success)</span>
                  </div>
                </div>
                <div class="tile-footer">
                    <h4>
                        <span class="pct-counter">{{$por_ven}}</span>% Vendidos
                    </h4>
                    <span></span>
                </div>
            </div>
        </div>
    </div>
    {{--*/$hay=Ganado::where('id_estado',4)->where('activo',1)->first();/*--}}
    @if(!empty($hay))
        <div class="col-md-9">
            <div class="bloque">
                <div class="table-responsive" style="overflow: auto">
                  <table class="table table-striped">
                    <tr>
                        <th width="50px">Cod-Ganado</th>
                        <th>Sexo</th>
                        <th>Color</th>
                        <th>Raza</th>
                        <th>Tipo</th>
                        <th>Nacimiento</th>
                        <th>Cod-Madre</th>
                        <th>Cod-padre</th>
                        <th>Opciones</th>
                    </tr>
                    @foreach(Ganado::where('id_estado',4)->where('activo',1)->get() as $ganado)
                        <tr>
                    
                            <td>{{$ganado -> cod_ganado}}</td>
                            <td>{{$ganado -> sexo}} 
                            </td>
                            <td>{{$ganado -> color}}</td>
                            <td>{{$ganado->id_raza}}</td>
                            <td>{{$ganado ->id_tipo}}</td>
                            <td>{{$ganado -> fecha_nacimiento}}</td>
                            <td>{{$ganado -> cod_madre}}</td>
                            <td>{{$ganado -> cod_padre}}</td>
                            <td>
                                <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#myModal" href="{{route('ganado.show',$ganado->id)}}">Ver</button>
                            </td>
                        </tr>
                    @endforeach
                </table>
                
              </div>
            </div>
        </div>
        @else
        <div class="col-md-9">
            <div class="bloque color3">
                    {{'No Existen Vacas Vendidas'}}
            </div>
        </div>
    @endif
</div>
<div class="row">
    <div class="col-sm-3">
        <div class="bloque">
            <div class="tile-progress tile-primary">
                <div class="tile-header">
                    <h3>MUERTOS</h3>
                    <span>{{'Del total de el Ganado Registrado: '.$ganado['total']}}</span>
                </div>

                <div class="progress">
                  <div class="progress-bar progress-bar-success" style="width:{{$por_muertos}}%">
                    <span class="sr-only">{{$por_muertos}} Muertos (success)</span>
                  </div>
                </div>
                <div class="tile-footer">
                    <h4>
                        <span class="pct-counter">{{$por_muertos}}</span>% Muertos
                    </h4>
                    <span></span>
                </div>
            </div>
        </div>
    </div>
    {{--*/$hay=Ganado::where('id_estado',2)->where('activo',1)->first();/*--}}
@if(!empty($hay))
    <div class="col-md-9">
        <div class="bloque">
            <div class="table-responsive" style="overflow: auto">
              <table class="table table-striped">
                <tr>
                    <th width="50px">Cod-Ganado</th>
                    <th>Sexo</th>
                    <th>Color</th>
                    <th>Raza</th>
                    <th>Tipo</th>
                    <th>Nacimiento</th>
                    <th>Cod-Madre</th>
                    <th>Cod-padre</th>
                    <th>Opciones</th>
                </tr>
                @foreach(Ganado::where('id_estado',2)->where('activo',1)->get() as $ganado)
                    <tr>
                
                        <td>{{$ganado -> cod_ganado}}</td>
                        <td>{{$ganado -> sexo}} 
                        </td>
                        <td>{{$ganado -> color}}</td>
                        <td>{{$ganado->id_raza}}</td>
                        <td>{{$ganado ->id_tipo}}</td>
                        <td>{{$ganado -> fecha_nacimiento}}</td>
                        <td>{{$ganado -> cod_madre}}</td>
                        <td>{{$ganado -> cod_padre}}</td>
                        <td>
                            <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#myModal" href="{{route('ganado.show',$ganado->id)}}">Ver</button>
                        </td>
                    </tr>
                @endforeach
            </table>
            
          </div>
        </div>
    </div>
    @else
    <div class="col-md-9">
        <div class="bloque color3">
                {{'No Existen Vacas Muertas'}}
        </div>
    </div>
@endif
</div>
@stop